# coding=utf-8
# 全世界最帅的帅哥
import json
from ysgg1_club_comment.utils.base_serializers import BaseSerializer, BaseListSerializer


class RoleSerializer(BaseSerializer):

    def to_dict(self):
        return {
            "id": self.data.id,
            "role_name": self.data.role_name,
            "role_key": self.data.role_key
        }


class RoleListSerializer(BaseListSerializer):

    def to_dict(self):
        role_info_list = []
        for role in self.data_list:
            role_info_list.append({
                "role_name": role.role_name,
                "role_key": role.role_key
            })

        return json.dumps(role_info_list)
